From: Andres Lagar-Cavilla Date: Thu, 24 Nov 2011 15:20:57 +0000 (+0000) Subject: x86/mm/p2m: fix pod locking X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=85826188d83ea040c55cfe1e3d92d8626c3e3c3d;p=xen.git x86/mm/p2m: fix pod locking The path p2m-lookup -> p2m-pt->get_entry -> 1GB PoD superpage -> pod_demand_populate ends in the pod code performing a p2m_set_entry with no locks held (in order to split the 1GB superpage into 512 2MB ones) Further, it calls p2m_unlock after that, which will break the spinlock. This patch attempts to fix that. Signed-off-by: Andres Lagar-Cavilla Acked-by: George Dunlap Acked-by: Tim Deegan Committed-by: Tim Deegan --- diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index 49ee48f48a..098cacabbf 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -987,7 +987,6 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned long gfn, set_p2m_entry(p2m, gfn_aligned, _mfn(0), PAGE_ORDER_2M, p2m_populate_on_demand, p2m->default_access); audit_p2m(p2m, 1); - p2m_unlock(p2m); return 0; } diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c index 7e48e7e3b4..d1ef744662 100644 --- a/xen/arch/x86/mm/p2m-pt.c +++ b/xen/arch/x86/mm/p2m-pt.c @@ -542,10 +542,11 @@ pod_retry_l3: /* The read has succeeded, so we know that mapping exists */ if ( q != p2m_query ) { - if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_1G, q) ) + if ( !p2m_pod_check_and_populate(p2m, gfn, + (l1_pgentry_t *) &l3e, PAGE_ORDER_1G, q) ) goto pod_retry_l3; p2mt = p2m_invalid; - printk("%s: Allocate 1GB failed!\n", __func__); + gdprintk(XENLOG_ERR, "%s: Allocate 1GB failed!\n", __func__); goto out; } else @@ -743,8 +744,10 @@ pod_retry_l3: { if ( q != p2m_query ) { - if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_1G, q) ) + if ( !p2m_pod_check_and_populate(p2m, gfn, + (l1_pgentry_t *) l3e, PAGE_ORDER_1G, q) ) goto pod_retry_l3; + gdprintk(XENLOG_ERR, "%s: Allocate 1GB failed!\n", __func__); } else *t = p2m_populate_on_demand;